package com.doit.day05

object _03_class类的小练习 {
  def main(args: Array[String]): Unit = {
    val robot: Robot = new Robot()

  }

}

//定义一个class类  要求 空参构造  全参构造都有
//类名 robot
//成员变量  id price 产地 颜色  体重
//方法 会杀人
//函数 会救人
class Robot(){

  var id:Int = 0
  var price:Double = 0.0
  var address:String = ""
  var color:String = ""
  var weight:Double = 0.0

  def this(id:Int,price:Double,address:String,color:String,weight:Double){
    this()
    this.id = id
    this.price = price
    this.address = address
    this.color = color
    this.weight = weight
  }

  def canKill()={
    println("杀人")
  }

  val canSave = ()=>{
    println("救人")
  }



}


